<!--
 * @Descripttion: 
 * @Author: cbing
 * @Date: 2019-04-25 15:00:00
 * @LastEditors: cbing
 * @LastEditTime: 2020-04-28 13:13:59
 -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
</head>
<script>
    // var deleteUrl = "{:url('Live/delete')}";
    var recycleUrl="{:url('Live/recycle')}";
</script>

<body class="gray-bg">
    <style>
	.qiehuan{
	    width:120px; height:40px; line-height:40px; font-size:14px; font-weight:bold; color:#333; background-color:#F5F5F6; float:left; margin-right:10px; text-align:center; cursor:pointer;
	}
    </style>
    <div class="wrapper wrapper-content" id="server">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>直播间列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row" style="margin-top:10px;margin-bottom:10px;">
                            <div class="col-sm-3 m-b-xs">
                                <a href="{:url('live/addLive')}" class="btn btn-sm btn-primary"><i class="fa fa-plus" style="color:#FFF;"></i>&nbsp;添加直播间</a>
                                <a href="{:url('live/hslst')}" style="margin-right:15px;"><button type="button" class="btn btn-sm btn-success"><i class="fa fa-paste"></i>&nbsp;回收站</button></a>
                            </div>
                            <form action="{:url('live/lst')}" method="post" id="form_search">
                            <div class="col-sm-3" style="float:right;">
                                <div class="input-group">
                                    <input type="text" name="keyword" placeholder="请输入描述关键字/电话/用户名" value="{:input('param.keyword')}" class="input-sm form-control">
                                    <span class="input-group-btn"><button type="submit" class="btn btn-sm btn-primary" id="submit_search2">搜索</button></span>
                                </div>
                            </div>
                           </form>
                           
                        </div>  
                        
                        
                        <div id="ajaxpagetest">
                            <table class="table table-hover table-bordered">
                                <thead>
                                <tr>
                                    <th style="width:5%">房间ID</th>
                                    <th style="width:10%">直播封面</th>
                                    <th style="width:10%">直播间名称</th>
                                    <th style="width:10%">直播房间号</th>
                                    <!--<th style="width:10%">商品类型</th>-->
                                    <th style="width:20%">主播信息</th>
                                    <th style="width:10%">所属店铺</th>
                                    <th style="width:10%">直播状态</th>
                                    <!--<th style="width:10%">最后直播开始时间</th>-->
                                    <!--<th style="width:5%">新人</th>-->
                                    <!--<th style="width:5%">推荐</th>-->
                                    <th style="width:6%">是否开启</th>
                                    <th style="width:10%">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {if condition="$list->isEmpty() == false"}
                                {foreach name="list" item="v"}
                                <tr>
                                    <td>{$v.id}</td>
                                    <td><img src="{$v.cover}" width="80px;"/></td>
                                    <td>{$v.title}</td>
                                    <!--<td>{$v.type_name}</td>-->
                                    <td>{$v.room}</td>
                                    <td>用户名:{$v.user_name}<br>手机号:{:mix_phone($v.phone)}</td>
                                    <td>{$v.shop_name}</td>
                                    <td>
                                        {switch name="v.status"}{case value="-1"}
                                        <span>等待直播</span>
                                        {/case}
                                        {case value="1"}
                                        <span style="color:#008000">直播中</span>
                                        {/case}
                                        {case value="2"}
                                        <span style="color:#f53c02">被管理员关闭</span>
                                        {/case}
                                        {/switch}
                                    </td>
                                    <!--<td>{$v.starttime|date="Y-m-d H:i:s",###}</td>-->
                                   

<!--                                    <td>
                                        {switch name="v.isnewperson"}
                                        {case value="1"}
                                        <button class="btn btn-primary btn-xs" type="button" onclick="isnewperson({$v.id});"><i class="fa fa-check"></i></button>
                                        {/case}
                                        {case value="-1"}
                                        <button class="btn btn-danger btn-xs" type="button" onclick="isnewperson({$v.id});"><i class="fa fa-times"></i></button>
                                        {/case}
                                        {/switch}
                                    </td>-->

                                    <td>
                                        {switch name="v.isclose"}
                                        {case value="0"}
                                        <button class="btn btn-primary btn-xs" type="button" onclick="changeTableVal({$v.id}, {$v.isclose});"><i class="fa fa-check"></i></button>
                                        {/case}
                                        {case value="1"}
                                        <button class="btn btn-danger btn-xs" type="button" onclick="changeTableVal({$v.id}, {$v.isclose});"><i class="fa fa-times"></i></button>
                                        {/case}
                                        {/switch}
                                    </td>

                                    <td>
                                        <a href="{:url('editLive',array('id'=>$v['id']))}" class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i>&nbsp;详情</a>
                                        <button type="button" class="btn btn-danger btn-xs" onclick="recycle({$v.id}, this);"><i class="fa fa-close"></i>&nbsp;删除</button>
                                        {if condition="$v['status'] eq 2"}
                                        <button type="button" class="btn btn-default btn-sm btn-block btn-warning" onclick="resetlive({$v['id']})"><i class="fa fa-exclamation-triangle"></i>恢复直播</button>
                                        {/if}
                                    </td>
                                </tr>
                                {/foreach}
                                {else/}
                                <tr><td colspan="11" style="text-align:center; font-size:14px;">没有找到相关数据</td></tr>
                                {/if}
                                </tbody>
                            </table>
                            <div class="row"><div class="pagination" style="float:right; margin-right:20px;">{$page}</div></div>
                        </div>                        
                        

                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/admin/js/common/admin.js"></script>
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>
    <script type="text/javascript">
        /**
         * 筛选查询
         */
        $("ul li a").on("click",function (e) {
            var url = $(this).attr("href");
            var formdata = $("#form_search").serialize();
            if(url.indexOf('?')<=-1){
                url = url+"?"+formdata;
            }else{
                url = url+"&"+formdata;
            }
            e.preventDefault();
            $(location).attr('href', url);
        });

        function resetlive(id){
            $.ajax({
                type: "POST",
                url: "{:url('resetlive')}",
                data: {'id':id},
                success: function(str){
                    console.log(str);
                }
            });
            window.setTimeout(function () {
                location.reload();
            },500);
        }

        /*
        是否是新人
         */
        function isnewperson(id) {
            $.ajax({
                url:"{:url('live/isnewperson')}",
                type:'POST',
                data:{id:id},
                dataType:'json',
                success:function(data) {
                    if(data.code == 200){
                        layer.msg(data.mess);
                    }else{
                        layer.msg(data.mess)
                    }
                }
            });
            window.setTimeout(function () {
                location.reload();
            },1000);
        }



        /*
        是否推荐
         */
        function isrecommend(id) {
            $.ajax({
                url:"{:url('live/isrecommend')}",
                type:'POST',
                data:{id:id},
                dataType:'json',
                success:function(data) {
                    if(data.code == 200){
                        layer.msg(data.mess);
                    }else{
                        layer.msg(data.mess)
                    }
                }
            });
            window.setTimeout(function () {
                location.reload();
            },1000);
        }
        
        function changeTableVal(id, isclose) {
            $.ajax({
                url:"{:url('Live/changeIsClose')}",
                type:'POST',
                data:{id: id, isclose: isclose},
                dataType:'json',
                success:function(data) {
                    if (!data.status) {
                        layer.msg(data.mess, {icon: 2,time: 2000});
                    } else {
                        location.reload();
                    }
                }
            });
        }
        
        function cl() {
            window.location.href = "{:url('live/lst')}";
        }
    </script>
	
</body>
</html>